<?php 
/* P3(c)

******************************************************************************
                                                                                      
                         __                                                        
                        /__)                                                       
                       /__        P3 - moving Technologie            
                        __)                                                          
                        __)                                                          
                                                                                        
                                                                                        
       Copyright 2009 by p3.co.at                                                                                 
                                                                                        
       visit www.p3.co.at to get more Informations 
       about Teriko - Betriebsdatenerfassung                                                                                 
       - it's not allowed to change this scripts
       - it's not allowed to remove this copyright-tag

       -- you can download the complete license   
          under http://www.teriko.org

 (c) by Patrik Pfaffenbauer and P3 (http://www.p3.co.at)

 | Programname: P3.Teriko
 | Authtor: P3.Verein
 | Coder: Patrik Pfaffenbauer
 | Version: 0.1

 | Change Index
 |_____________________________________________
 |                                             |
 |4.3.2010 Erstellung | Patrik Pfaffenbauer    |
 |_____________________________________________|

******************************************************************************

P3(c) */ 

function AddCSS()
{
	session_start();
	$site = $_GET['s'];

	if($_SESSION['loggedIn'] == "")
		$site = "login";
		
	if($site == "login")
	{
		echo '<link rel="stylesheet" type="text/css" href="css/system/login.css" />';
	}
	else
	{
		echo '<link rel="stylesheet" type="text/css" href="css/system/template.css" />';
	}
		
	echo '
		<link rel="stylesheet" type="text/css" href="css/system/system.css" />
		<link rel="stylesheet" type="text/css" href="css/system/rounded.css" />
		<link rel="stylesheet" type="text/css" href="css/p3/date.css" /> 
		<link rel="stylesheet" type="text/css" href="css/p3/p3-tab.css" />
		<link rel="stylesheet" type="text/css" href="css/p3/p3-general.css" />
		<!--[if IE 7]><link href="/css/system/ie7.css" rel="stylesheet" type="text/css" /><![endif]-->
		<!--[if IE 6]><link href="/css/system/ie6.css" rel="stylesheet" type="text/css" /><![endif]-->';
	
	$content = GetObject($_GET['s']);
	$content->AddCSS();
}
function AddJS()
{
	echo '
	<script type="text/javascript" src="js/ckeditor/ckeditor.js"></script>
	<script type="text/javascript" src="js/sdk/mootools-core.js"></script>
  	<script type="text/javascript" src="js/sdk/mootools-more.js"></script>
  	<script type="text/javascript" src="js/base/modal.js"></script>
	<script type="text/javascript" src="js/base/menu.js"></script>
	<script type="text/javascript" src="js/overlib/overlib.js"></script>
	<script type="text/javascript" src="js/p3/p3-teriko.js"></script>
	<script type="text/javascript" src="js/p3/p3-teriko-language.php"></script>
	<script type="text/javascript" src="js/p3/p3-teriko-edit.js"></script>
	<script type="text/javascript" src="js/p3/p3-teriko-ui.js"></script>
	<script type="text/javascript" src="js/p3/p3-ajax.js"></script>
	<script type="text/javascript" src="js/p3/p3-tab.js"></script>
	<script type="text/javascript" src="js/base/datepickercontrol.js"></script>
	';
	
	$content = GetObject($_GET['s']);
	$content->AddJS();
}

function AddContentLink($link, $img, $name)
{
	echo '
		<div style="float:left;">
			<div class="icon">
				<a href="'.$link.'">
					<img src="'.$img.'" alt="'.$name.'"  />	
						<span>
							'.$name.'
						</span>
				</a>
			</div>
		</div>
		';
}	
function AddContentMessage($header, $text)
{
	echo '<div id="content-pane" class="pane-sliders">
										<div class="panel">
											<h3 class="jpane-toggler title" id="cpanel-panel-custom">
												<span>
													'.htmlentities($header).'
												</span>
											</h3>
											<div class="jpane-slider content">
												<div style="padding: 5px">
												<p>'.$text.'</p>
											</div>
										</div>
									</div>';
}

function PaintDefaultToolbar($modul, $edit=true)
{
	$smarty = GetSmarty();

	if($modul->permission->editPermission)
		{	
			if($_POST['action'] == "add" || $_POST['action'] == "edit")
			{
				if($_POST['action'] == "add")
					$type = "save";
				else
					$type = "update";
					
				//Paint Template for Toolbarbutton Save
				$smarty->assign("title", $GLOBALS['lang']->GetLanguage("Common", "save"));
				$smarty->assign("id", "toolbar-save");
				$smarty->assign("class", "icon-32-save");
				$smarty->assign("action", "Submitform('save')");
				
				$smarty->display('toolbar_button.tpl');

				//Paint Template for Toolbarbutton Abort
				$smarty->assign("title", $GLOBALS['lang']->GetLanguage("Common", "abort"));
				$smarty->assign("id", "toolbar-cancel");
				$smarty->assign("class", "icon-32-cancel");
				$smarty->assign("action", "Submitform('cancel')");
				
				$smarty->display('toolbar_button.tpl');

			}
			else
			{
				
				//Paint Template for Toolbarbutton Abort
				$smarty->assign("title", $GLOBALS['lang']->GetLanguage("Common", "new"));
				$smarty->assign("id", "toolbar-new");
				$smarty->assign("class", "icon-32-new");
				$smarty->assign("action", "Submitform('add')");
				
				$smarty->display('toolbar_button.tpl');
				
				if($edit)
				{
					$smarty->assign("title", $GLOBALS['lang']->GetLanguage("Common", "edit"));
					$smarty->assign("id", "toolbar-edit");
					$smarty->assign("class", "icon-32-edit");
					$smarty->assign("action", "CheckAdminForm('edit')");
					
					$smarty->display('toolbar_button.tpl');
				}


				if($modul->permission->deletePermission)
				{
					$smarty->assign("title", $GLOBALS['lang']->GetLanguage("Common", "delete"));
					$smarty->assign("id", "toolbar-delete");
					$smarty->assign("class", "icon-32-delete");
					$smarty->assign("action", "OnConfirm('delete')");
					
					$smarty->display('toolbar_button.tpl');
				}
			}
		}
		
		$smarty->assign("title", $GLOBALS['lang']->GetLanguage("Common", "help"));
		$smarty->assign("id", "toolbar-help");
		$smarty->assign("class", "icon-32-help");
		$smarty->assign("action", "OpenHelpMenu('".$modul->moduleID."', '".$_GET['s']."');");
			
		$smarty->display('toolbar_button.tpl');
}
?>